<template>
  <ul class="hot">
    <loading v-if="benefit.length == 0"></loading>
    <router-link
      tag="li"
      v-for="i in benefit"
      :key="i.id"
      :to="`/detail/${i.id}`"
    >
      <div class="left">
        <img :src="i.image" />
      </div>
      <div class="right">
        <div class="van-ellipsis">{{ i.store_name }}</div>
        <h2>促销价:￥{{ i.price }}</h2>
        <span style="text-decoration: line-through"
          >日常价:￥{{ i.ot_price }}</span
        >
        <span class="right">仅剩
            <span v-if="i.stock">{{ i.stock }}</span>
            <span v-if="i.sales">{{i.sales}}</span>
            <span>{{ i.unit_name }}</span>
        </span>
      </div>
    </router-link>
  </ul>
</template>
<script>
import Loading from "@/components/Loading";
export default {
    name:"HotList",
  props: {
    benefit: {
      type: Array,
      default: function () {
        return [];
      },
      id: [String, Number],
    },
  },
  data(){
      return{
          
      }
  },
  components: {
    Loading,
  },
};
</script>
<style lang="less" scoped>
.hot {
  li {
    position: relative;
    font-size: 16px;
    padding: 10px 0px;
    border-bottom: #99999938 1px solid;
    margin: 5px;
    .left {
      position: absolute;
      width: 80px;
      left: 10px;
      img {
        width: 100%;
      }
    }
    .right {
      line-height: 25px;
      margin-left: 100px;
      font-size: 17px;
      h2 {
        font-size: 12px;
        color: #fff;
        background: var(--cy-Color);
        padding-left: 5px;
        border-radius: 15px 0px 15px 0px;
        width: 100px;
        margin: 5px;
      }
      span {
        font-size: 12px;
        color: #999;
        padding: 2px;
      }
      span.right {
        position: absolute;
        right: 10px;
      }
    }
  }
}
</style>